public class test2 {
    public static void main(String[] args) {
        circle c1 = new circle(3);
        System.out.println("面积为"+c1.getS());
        circle c2 = new circle(-2);
        if(c2.getR()<0){
            throw new ageexception("半径不能小于0");
        }
        System.out.println(c2.getS());
    }
}
class circle{
    private double r;
    private double s;
    public circle(double r){
        this.r=r;
    }
    public void setR(double r) {
        this.r = r;
    }
    public double getR() {
        return r;
    }
    public double getS() {
       
        return r*3.14;
    }
}
class ageexception extends RuntimeException{
    public ageexception(String message){
        super (message);
    }
}